#pragma once

#include "ast.hpp"
#include <map>
#include <memory>
#include <string>

const std::map<std::string, std::string> type_mapper{
    {"int", "i32"},
};

std::unique_ptr<std::string> to_koopa_text(std::unique_ptr<BaseAST>& ast);

void visit_ast(CompUnitAST*&& comp_unit,
               std::ostringstream&           decl,
               std::ostringstream&           inst);
void visit_ast(FuncDefAST*&& func_def,
               std::ostringstream&          decl,
               std::ostringstream&          inst);
void visit_ast(BlockAST*&& block,
               std::ostringstream&          decl,
               std::ostringstream&          inst);
void visit_ast(StmtAST*&& statement,
               std::ostringstream&          decl,
               std::ostringstream&          inst);
void visit_ast(ExpAST*&& exp,
               std::ostringstream&          decl,
               std::ostringstream&          inst);
void visit_ast(UnaryExpAST*&& uexp,
               std::ostringstream&          decl,
               std::ostringstream&          inst);
void visit_ast(PrimaryExpAST*&& pexp,
               std::ostringstream&          decl,
               std::ostringstream&          inst);